package rocket.test;

import java.util.Date;
import java.util.Random;

import rocket.users.Bill;
import rocket.users.User;
/**
 * 
 * @author justin
 * @version
 *
 */
public class RandomUser {

	private static Random rand = new Random();

	/**
	 * @return
	 */
	@SuppressWarnings("deprecation")
	public static User getBill() {

		String birthDate = "";
		long time = (1000000000000L + Long.parseLong("" + rand.nextInt(10000000)
				+ "" + rand.nextInt(10000000)));
		Date d = new Date(time);
		birthDate += d.getYear();
		while (birthDate.length() < 4) birthDate = "0" + birthDate;
		birthDate += d.getMonth();
		while (birthDate.length() < 6) birthDate = birthDate.substring(0, 4) + "0" + birthDate.substring(4);
		birthDate += d.getDay();
		while (birthDate.length() < 8) birthDate = birthDate.substring(0, 6) + "0" + birthDate.substring(6);

		String city = "";
		for (int i = 0; i < 10; i++) {
			city += "" + (char) (rand.nextInt(26) + 'a');
		}

		String gender = (rand.nextBoolean()) ? "M" : "F";

		String insurance = "";
		for (int i = 0; i < 20; i++) {
			insurance += "" + (char) (rand.nextInt(26) + 'a');
		}

		String name = "";
		for (int i = 0; i < 6; i++) {
			name += "" + (char) (rand.nextInt(26) + 'a');
		}

		String pharmacy = "";
		for (int i = 0; i < 20; i++) {
			pharmacy += "" + (char) (rand.nextInt(26) + 'a');
		}

		String phone = "";
		for (int i = 0; i < 10; i++) {
			phone += rand.nextInt(10);
		}

		String region = "";
		for (int i = 0; i < 10; i++) {
			region += "" + (char) (rand.nextInt(26) + 'a');
		}

//		System.out.println("BirthDate: " + birthDate);
//		System.out.println("City: " + city);
//		System.out.println("Gender: " + gender);
//		System.out.println("Insurance: " + insurance);
//		System.out.println("Name: " + name);
//		System.out.println("Pharmacy: " + pharmacy);
//		System.out.println("Phone: " + phone);
//		System.out.println("Region: " + region);
		
		User user = new Bill(0, birthDate, city, gender, insurance, name,
				pharmacy, phone, region, null);
		return user;
	}

	public String toString(){
		return "Random User";
	}

}
